package com.vcredit.creditcat.service;

import com.vcredit.creditcat.framework.pagination.DefaultCriteria;
import com.vcredit.creditcat.framework.pagination.Page;
import com.vcredit.creditcat.model.ChannelCharacter;
import com.vcredit.creditcat.persistence.ChannelCharacterMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by liaoshengjun on 2017/11/2.
 */
@Service
public class ChannelCharacterService {
	@Autowired
	private ChannelCharacterMapper channelCharacterMapper;

	public void insert(ChannelCharacter obj){
		channelCharacterMapper.insert(obj);
	}
	public void update(ChannelCharacter obj){
		channelCharacterMapper.update(obj);
	}
	public ChannelCharacter findById(Long id){
		return channelCharacterMapper.findById(id);
	}
	public List<ChannelCharacter> findAll(){
		return channelCharacterMapper.findAll();
	}
	public List<ChannelCharacter> find(ChannelCharacter obj){
		return channelCharacterMapper.find(obj);
	}
	public Page<ChannelCharacter> findByPage(DefaultCriteria criteria){
		long count=channelCharacterMapper.findByPageCount(criteria);
		List<ChannelCharacter> channelCharacterList=channelCharacterMapper.findByPage(criteria);
		return new Page<ChannelCharacter>(count, channelCharacterList);
	}
}
